package com.example.hellodemo.datastorage;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.example.hellodemo.R;

public class DataStorageActivity extends AppCompatActivity implements  View.OnClickListener{
    private Button shareperferencesBtn,fileBtn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_data);
        shareperferencesBtn = findViewById(R.id.data_shareperferences);
        shareperferencesBtn.setOnClickListener(DataStorageActivity.this);
        fileBtn = findViewById(R.id.data_file);
        fileBtn.setOnClickListener(DataStorageActivity.this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = null;
        switch (v.getId()){
            case R.id.data_shareperferences:
                intent = new Intent(DataStorageActivity.this, SharedPreferencesActivity.class);
                break;
            case R.id.data_file:
                intent = new Intent(DataStorageActivity.this, FileActivity.class);

                break;
        }
        startActivity(intent);
    }
}
